import { post, get, put, del } from '../utils/request';

/**
 * 平台管理相关API
 */

// 获取入驻申请列表
export const getPlatformApplications = (params?: {
  page?: number;
  pageSize?: number;
  status?: string;
  keyword?: string;
}) => {
  return get('/v1/platform/applications', params);
};

// 获取申请详情
export const getApplicationDetail = (id: string) => {
  return get(`/v1/platform/application/${id}`);
};

// 审核入驻申请
export const auditApplication = (id: string, data: {
  status: string;
  auditNote?: string;
}) => {
  return post(`/v1/platform/application/${id}/audit`, data);
};

// 获取平台反馈列表
export const getFeedbackList = (params?: {
  page?: number;
  pageSize?: number;
  status?: string;
  type?: string;
  keyword?: string;
}) => {
  return get('/v1/platform/feedback/list', params);
};

// 获取反馈详情
export const getFeedbackDetail = (id: string) => {
  return get(`/v1/platform/feedback/${id}`);
};

// 处理反馈
export const handleFeedback = (id: string, data: {
  status: string;
  reply?: string;
}) => {
  return put(`/v1/platform/feedback/${id}`, data);
};

// 获取推广活动列表
export const getPromotionList = (params?: {
  page?: number;
  pageSize?: number;
  status?: string;
  type?: string;
  keyword?: string;
}) => {
  return get('/v1/platform/promotion/list', params);
};

// 创建推广活动
export const createPromotion = (data: {
  title: string;
  type: string;
  startDate: string;
  endDate: string;
  budget: number;
  description?: string;
}) => {
  return post('/v1/platform/promotion', data);
};

// 更新推广活动
export const updatePromotion = (id: string, data: {
  title?: string;
  type?: string;
  startDate?: string;
  endDate?: string;
  budget?: number;
  description?: string;
}) => {
  return put(`/v1/platform/promotion/${id}`, data);
};

// 删除推广活动
export const deletePromotion = (id: string) => {
  return del(`/v1/platform/promotion/${id}`);
};
